package com.wyd.principle.SingleResponsbility;

public class SingleResponsbility02 {
    public static void main(String[] args) {
        VehicleBoat vehicleBoat = new VehicleBoat();
        vehicleBoat.run();
        VehicleCar vehicleCar = new VehicleCar();
        vehicleCar.run();
        VehiclePlane vehiclePlane = new VehiclePlane();
        vehiclePlane.run();
    }
}

/**
 * 将Vehicle按照不同的职责进行拆分
 */
class VehicleCar{
    public void run(){
        System.out.println("汽车在路面运行……");
    }
}

class VehicleBoat{
    public void run(){
        System.out.println("轮船在水面运行……");
    }
}

class VehiclePlane{
    public void run(){
        System.out.println("飞机在天空运行……");
    }
}
